home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / mui / mui-tools / multiuser / src / support / limitdossetprotection.c < prev    next >
C/C++ Source or Header  |  1995-03-09  |  2KB  |  62 lines

  1. /************************************************************
  2. * MultiUser - MultiUser Task/File Support System                *
  3. * ---------------------------------------------------------    *
  4. * LimitDOSSetProtection                                                    *
  5. * ---------------------------------------------------------    *
  6. * © Copyright 1993-1994 Geert Uytterhoeven                        *
  7. * All Rights Reserved.                                                    *
  8. ************************************************************/
  9.  
  10.  
  11. #include <exec/types.h>
  12. #include <dos/dos.h>
  13. #include <proto/exec.h>
  14. #include <proto/dos.h>
  15. #include <utility/tagitem.h>
  16. #include <libraries/multiuser.h>
  17. #include <proto/multiuser.h>
  18.  
  19. #include "LimitDOSSetProtection_rev.h"
  20.  
  21. #include "Locale.h"
  22.  
  23. char __VersTag__[] = VERSTAG;
  24.  
  25.  
  26. int __saveds Start(char *arg)
  27. {
  28.     struct ExecBase *SysBase;
  29.     struct DosLibrary *DOSBase;
  30.     struct muBase *muBase = NULL;
  31.     struct RDArgs *args;
  32.     LONG argarray[] = {
  33.         NULL, NULL
  34.     };
  35.     int rc = RETURN_ERROR;
  36.  
  37.     SysBase = *(struct ExecBase **)4;
  38.  
  39.     if ((!(DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 37))) ||
  40.          (!(muBase = (struct muBase *)OpenLibrary("multiuser.library", 39)))) {
  41.         rc = ERROR_INVALID_RESIDENT_LIBRARY;
  42.         goto Exit;
  43.     }
  44.  
  45.     args = ReadArgs("ON/S,OFF/S", argarray, NULL);
  46.     if (!args)
  47.         PrintFault(IoErr(), NULL);
  48.     else if (argarray[0] && argarray[1])
  49.         PutStr(GetLocStr(MSG_BOTH_ONOFF));
  50.     else if (!argarray[0] && !argarray[1])
  51.         PutStr(GetLocStr(MSG_NO_ONOFF));
  52.     else
  53.         muLimitDOSSetProtection((BOOL)argarray[0]);
  54.     FreeArgs(args);
  55.  
  56. Exit:
  57.     CloseLibrary((struct Library *)muBase);
  58.     CloseLibrary((struct Library *)DOSBase);
  59.  
  60.     return(rc);
  61. }
  62.